package com.openbravo.pos.printer.escpos;

import com.openbravo.pos.util.PrinterUtil;

public abstract class AbstractDisplayESCPOS extends DeviceDisplaySerial {

	protected UnicodeTranslator trans;


	@Override
	public void initVisor() {
	    display.init(ESCPOS.INIT);
	    display.write(ESCPOS.SELECT_DISPLAY); // Al visor
	    display.write(trans.getCodeTable());
	    display.write(ESCPOS.VISOR_HIDE_CURSOR);         
	    display.write(ESCPOS.VISOR_CLEAR);
	    display.write(ESCPOS.VISOR_HOME);
	    display.flush();
	}

	public void repaintLines() {
	    
	    display.write(ESCPOS.SELECT_DISPLAY);
	    display.write(ESCPOS.VISOR_CLEAR);
	    display.write(ESCPOS.VISOR_HOME);
	    display.write(trans.transString(PrinterUtil.alignLeft(m_displaylines.getLine1(), 20)));
	    display.write(trans.transString(PrinterUtil.alignLeft(m_displaylines.getLine2(), 20)));        
	    display.flush();
	}

}